﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;

namespace JieBooLaw.WebSite
{
    using JieBooLaw.Service;
    using JieBooLaw.Domain;
    using JieBooLaw.Common.Web.Util;
    public partial class List : System.Web.UI.Page
    {
        public string vStitle;
        public int ItemID;
        protected void Page_Load(object sender, EventArgs e)
        {
            if(!this.IsPostBack)
            {
                  BindGrid();
                  TInfoRelease_ItemSvc ItmSvc = new TInfoRelease_ItemSvc();
                  string  title=(from lt in ItmSvc.GetAllList() where lt.ItemID.Equals(Convert.ToInt32(Request.QueryString["itmid"]))  select lt).ToList<TInfoRelease_Item>()[0].ItemName;
                  vStitle = (from lt in ItmSvc.GetAllList() where lt.ItemID.Equals(Convert.ToInt32(Request.QueryString["id"])) select lt).ToList<TInfoRelease_Item>()[0].ItemName;
                  if (!title.Equals(vStitle) && !title.Equals("首页"))
                  {
                     this.p_div.InnerHtml = "您现在的位置：<a href='index.aspx'>首页</a> > " + title + " >  " + vStitle;
                  }else{
                      this.p_div.InnerHtml = "您现在的位置：<a href='index.aspx'>首页</a> > " +((title.Equals("首页")==true)?vStitle:title);
                  }
              
            }
        }
        public void BindGrid()
        {
            TInfoRelease_InfoSvc svc = new TInfoRelease_InfoSvc();
            TInfoRelease_Info entity = new TInfoRelease_Info();
            ItemID = Convert.ToInt32(Request.QueryString["id"]);
            IList<TInfoRelease_Info> entityList = (from LsInfo in svc.GetAllList() where LsInfo.ItemID.Equals(ItemID) select LsInfo).ToList<TInfoRelease_Info>();

            this.reGsNew.DataSource = this.AspNetPager1.AutoPagedDataSource(entityList);
            this.reGsNew.DataBind();
        }
        protected void AspNetPager1_PageChanged(object sender, EventArgs e)
        {
            BindGrid();
        }
    }
}
